import React, { Component } from "react";
import { createPage } from "nc-lightapp-front";
import {
  buttonClick,
  initTemplate,
  afterEvent,
  refreshButtonClick,
} from "./events";
import {
  ProfileStyle,
  ProfileHead,
  ProfileBody,
  ButtonGroup,
  EmptyArea
} from "ssccommon/components/profile";
import { EditTable } from "ssccommon/components/table";
import "./index.less";
import pubMessage from "ssccommon/utils/pubMessage";

class SingleTable extends Component {
  constructor(props) {
    super();
    initTemplate.call(this, props);
    this.state = {
      status: "browse",
    };
    this.pubMessage = new pubMessage(props);
  }

  componentWillMount() {
    window.onbeforeunload = () => {
      let status = this.props.editTable.getStatus(window.bodycode);
      if (status == "edit") {
        return "";
      }
    };
  }

  render() {
    // let multiLang = this.props.MutiInit.getIntl(2011);
    let props = this.props;
    let multiLang = props.MutiInit.getIntl(2011)

    return (
      /*档案风格布局*/
      <ProfileStyle layout="singleTable" {...this.props}>
        {/*页面头*/}
        <ProfileHead
          title={multiLang.get('201103INME-0001')}
          refreshButtonEvent={refreshButtonClick.bind(this, props)}
          status={this.state.status}
        >
          <ButtonGroup
            area="page_header"
            buttonLimit="3"
            buttonEvent={buttonClick.bind(this)}
          />
        </ProfileHead>

        {/*页面体*/}
        <ProfileBody>
          
          <EmptyArea>
            <div className="header-intro">
              <span>{multiLang.get('201103INME-0002')}</span>
              <p>{multiLang.get('201103INME-0003')}</p>
            </div>
            
          </EmptyArea>

          <EditTable
            areaId="page_header"
          >
          </EditTable>
        </ProfileBody>
      </ProfileStyle>
    );
  }
}

SingleTable = createPage({
  mutiLangCode: "2011",
})(SingleTable);

export default SingleTable;
